#ifndef __GAME_H__
#define __GAME_H__

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <assert.h>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <list>
#include <BeatObject.h>
#include <Command.h>
#include <EchoParser.h>
#include <BaseMap.h>


/*#include <ICharacter.h>
#include <PlayerCharacter.h>
#include <NonPlayerCharacter.h>
*/

/*Global function prototypes*/
const char* strlstr(const char* s1, const char* s2);


class PlayerCharacter;
class NonPlayerCharacter;

#define MAX_QUEUE_SIZE 10
#define BEAT_OBJECT_INTERVAL 2
#define BEAT_MATCH_THRESHOLD 0.5
#define ACHIEVEMENT_MAX 10
#define ACHIEVEMENT_MIN 1

using namespace std;

class Game
{
	/*
	NOTES:
		-call setLastPassedMusicPoint();
		-then setMusicTimestamp()
		-and call update() with Ogre time
		
	POTENTIAL PROBLEMS:
		-user goes through song collecting points up until very end
		-turns around and goes back to the beginning
		-will take all audio textured stuff since score is high enough
		-unless we deduct points
	*/
	
	private:
		int mScore;
		int mAchievementLevel;
		EchoParser* mParsedSong;
		float mElapsedTime; //The amount of seconds that have passed so far
		unsigned int mMusicTimestamp;
		PlayerCharacter* mPlayer;
		vector<NonPlayerCharacter*>* mEnemies;
		vector<Command_t*>* mCommands;
		BaseMap* mBaseMap;
		bool mIsOver;
		float mTimeSinceStarted;
		vector<Point*>* mMusicPoints;
		int mLastPassedMusicPoint;
		int mLastPassedMusicPoint2;
		map<Point*, int>* mPointBenchmarks;
		
		
	public:
		
		Game(EchoParser* song);
		~Game();
		
		bool isOver();
		void update(float timeSinceStarted);
		
		/*
		Note: Must be called AFTER setLastPassedMusicPoint() is called
		for the new point that was jumped to
		*/
		void tookAudioTexturedPath();
		
		//Accessors
		
		int getScore();
		EchoParser* getSong();
		vector<Command_t*>* getCommands();
		vector<NonPlayerCharacter*>* getEnemies();
		int getAchievementLevel();
		int getLastPassedMusicPoint();
		
		
		//Modifiers
		void addEnemy(NonPlayerCharacter* e);
		void addScore(int s);
		void setLastPassedMusicPoint(int p);
		void setMusicTimestamp(unsigned int timestamp);
		void setMusicPoints(vector<Point*>* musicPoints); //should only be called once
		void setPlayerCharacter(PlayerCharacter* p);
		void setCommands(vector<Command_t*>* commands);
		void setBaseMap(BaseMap* m);
		
};
#include <ICharacter.h>

#endif
